#include <stdio.h>
// 练习6:修改加盟费那道题，可以让用户多次计算营业额的加盟费
int main()
{
    float n;
    float rate;
    while (1)
    {
        printf("请输入营业额(万元):");
        int ret = scanf("%f", &n);
        if (ret != 1)
        {
            printf("数据异常！\n");
            while (getchar() != '\n')
                ;
            // return 0;
            continue;
        }

        if (n < 0)
        {
            printf("就这还能不赚钱？");
        }
        switch (n >= 100 ? 6 : n >= 60 ? 5
                           : n >= 40   ? 4
                           : n >= 20   ? 3
                           : n >= 10   ? 2
                                       : 1)
        {
        case 1:
            rate = 0.1;
            break;
        case 2:
            rate = 0.075;
            break;
        case 3:
            rate = 0.05;
            break;
        case 4:
            rate = 0.03;
            break;
        case 5:
            rate = 0.015;
            break;
        case 6:
            rate = 0.01;
            break;
        default:
            break;
        }
        printf("加盟费：%.3f*10000*%.3f=%.3f元\n", n, rate, n * rate * 10000);
    }
}